package com.cn.controller;

import com.cn.pojo.Admin;
import com.cn.pojo.User;
import com.cn.service.AdminService;
import com.cn.utils.uploadImage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.io.IOException;

/**
 * @author:王宇航
 * @create: 2023-05-25 16:57
 * @Description:
 */
@RestController //该Controller全部返回JSON格式
@RequestMapping("/admin")
@EnableWebMvc
public class AdminController {
    @Autowired
    private AdminService adminService;
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public Admin payStatus(@RequestBody Admin admin) {
        Admin admin1 = adminService.findAdmin(admin);
        return admin1;
    }
    @RequestMapping(value = "/lock/{status}", method = RequestMethod.PUT)
    public boolean lock(@PathVariable int status, @RequestBody User user) {
        int lock = adminService.lock(status, user);
        System.out.println(status);
        System.out.println(user);
        if (lock>0){
            return true;
        }else {
            return false;
        }


    }

}
